<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>下拉热门搜索</title>
    <style>
        * {
            margin: 0;
            padding: 0;
            list-style: none;
            box-sizing: border-box;
        }
        .search-box{
            width: 200px;
            margin: 30px auto;
        }
        .search-box input {
            border: 1px solid orange;
            width: 100%;
            height: 30px;
            padding: 5px;
            outline: none;
        }
        .hot-goods {
            width: 100%;
            border: 1px solid orange;
            padding: 0 10px;
            display: none;
        }
        .hot-goods li {
            line-height: 30px;
            font-size: 14px;
        }
    </style>
</head>
<body>
    <div class="search-box">
        <input class="search-value" type="text" placeholder="请输入搜索内容">
        <ul class="hot-goods">
            <li>全部商品</li>
            <li>华为mate60</li>
            <li>华为笔记本</li>
            <li>智能蓝牙耳机</li>
            <li>智能手表</li>
        </ul>
    </div>
    <script>
        const searchValue = document.querySelector(".search-value")
        const hotGoods = document.querySelector('.hot-goods')
        searchValue.addEventListener("focus", ()=>{
            hotGoods.style.display = "block"
        })
        searchValue.addEventListener("blur", ()=>{
            hotGoods.style.display = "none"
        })
    </script>
</body>
</html>